<template>
  <div>
    <el-form-item :prop="item.name || ''" :label="item.label" v-bind="item.formItemProps || {}" ref="el-form-item">
      <el-cascader ref="input" v-model="mvalue" style="width: 100%;" v-bind="opt"></el-cascader>
    </el-form-item>
  </div>
</template>

<script>
  import { objectAssign } from "../../utils/common";
  import Required from "../validMixins/Required";

  export default {
    name: "PopoCascader",
    props: {
      value: { type: [String, Array] },
      item: { type: Object },
      formData: { type: Object },
    },
    mixins: [Required],
    data() {
      return {
        mvalue: this.value,
        opt: {},
      };
    },
    watch: {
      mvalue(val) {
        this.$emit("input", val);
      },
    },
    created() {
      var opt = objectAssign(
        {
          options: this.item.options || [],
        },
        this.item.props
      );

      // opt.options = this.item.options || [];
      // opt.options = this.item.options || [];
      // opt.props = opt.props || {};
      opt.props = objectAssign(
        {
          emitPath: this.item.emitPath || false,
        },
        opt.props,
        {}
      );

      this.opt = opt;
    },
    methods: {},
  };
</script>
